/* MEDIA */


main code {
    font-size: var(--size-small);
}


/* --------------------------------------------------------- lightbox */

table#medialist .thumbnail .lightbox {
    display: none;
    white-space: pre-wrap;
    position: absolute;
    max-width: 350px;
    max-height: 200px;
    background-color: var(--secondary-background-color);
    padding: 5px;
    left: 30px;
    top: 60px;
    box-shadow: 0px 14px 14px #24242430;
}

table#medialist .thumbnail:hover .lightbox {
    display: block;
}


/* --------------------------------------------------------- dir list */

#dirlist a {
    white-space: nowrap;
}

#dirlist tr.selected a, #dirlist tr.selected td {
    background-color: var(--outline-background-color);
    color: var(--outline-color);
}


/* --------------------------------------------------------- gallery */

#gallery {
    overflow: hidden;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: var(--spacing);
    padding: var(--spacing);
}

#gallery li {   
    width: 100%;
    overflow: hidden;
    margin: 0;
    padding: 0;
    background: white;
}

#gallery .thumbnail {
    width: 100%;
    height: 116px;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: var(--spacing);
    font-size: 8em;
}

#gallery .thumbnail label {
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

#gallery .thumbnail video, #gallery .thumbnail audio {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    max-height: 117px;
    box-shadow: 0px 4px 4px #24242430;
}

#gallery .thumbnail img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: block;
    box-shadow: 0px 4px 4px #24242430;
    /* checkerboard pattern */
    background-image: linear-gradient(45deg, #ddd 25%, transparent 25%), linear-gradient(-45deg, #ddd 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #ddd 75%), linear-gradient(-45deg, transparent 75%, #ddd 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
}

.meta {
    display: grid;
    grid-template-columns: min-content 1fr min-content;
    padding: var(--spacing);
    gap: var(--half-spacing);
}
.meta label {
    display: inline-block;
    text-wrap: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
    font-size: var(--size-small);
}
.meta code {
    grid-column: 1 / span 3;
    margin: 0 var(--reset-spacing) var(--reset-spacing);
    width: calc(100% + var(--spacing) * 2);
}


/* --------------------------------------------------------- main table */

table#medialist td.filename label {
    font-family: monospace;
    white-space: pre;
    font-size: 14px;
    width: 100%;
}

table code.select-all {
    max-width: 254px;
}

/* Renamming feature */

table#medialist td.filename {
    position: relative;
}

table#medialist td.filename {
    padding-right: calc(1em + var(--spacing));
}

table#medialist td.filename details summary {
    visibility: hidden;
    list-style: none;
    position: absolute;
    right: 0;
    /* verticlaly centered */
    top: 50%;
    transform: translateY(-50%);
}

table#medialist td.filename:hover details summary {
    visibility: visible;
}

table#medialist td.filename details[open] ~ label {
    display: none;
}

table#medialist td.filename details[open] form {
    display: flex;
    gap: var(--spacing);
    /* avoid height bump on open */
    margin: var(--reset-spacing) 0;
}
table#medialist td.filename details[open] input[type="text"] {
    flex: 1;
}

table#medialist td.filename details[open] .fa-pencil::before {
    /* close icon */
    content: "\f00d";
}

table#medialist td.filename details[open] summary {
    visibility: visible;
}


/* --------------------------------------------------------- media queries */

@media (max-width: 550px) {
    
    #gallery {
        grid-template-columns: repeat(3, 1fr);
    }

    #gallery li div.thumbnail {
        font-size: 4em;
    }

}
